<script setup lang="ts">

defineComponent({
  name: 'UserAvatar'
})

defineProps({
  url: {
    type: String,
    required: true
  }
})
</script>

<template>
  <div class="avatar-border">
    <div class="avatar-bg">
      <img class="avatar-user" :src="url" alt="头像"/>
    </div>
    <img class="user-border" src="/src/assets/images/avatar-border-1.png" alt="边框"/>
  </div>
</template>

<style scoped lang="scss">
.avatar-border {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
  .avatar-bg {
    width: 90px;
    height: 90px;
    border-radius: 50%;
    overflow: hidden;
    background-color: red;
    .avatar-user {
      width: 100%;
      //height: 100%;
    }
  }


  .user-border {
    position: absolute;
    /*居中*/
    left: 48%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 100%;
    height: 100%;
  }
}

</style>
